#include<stdio.h>

struct Node {
    int value;
    struct Node* next;
};

int main() {
    int m, i, count;
    scanf("%d", &m);
    
    struct Node* head = NULL;
    struct Node* current = NULL;
    
    for (i = 0; i < m; i++) {
        int c;
        scanf("%d", &c);
        
        struct Node* newNode = (struct Node*)malloc(sizeof(struct Node));
        newNode->value = c;
        newNode->next = NULL;
        
        if (head == NULL) {
            head = newNode;
            current = newNode;
        } else {
            current->next = newNode;
            current = newNode;
        }
    }
    
    scanf("%d", &count);
    
    for (i = 0; i < count; i++) {
        int start, end, score;
        scanf("%d", &start);
        scanf("%d", &end);
        scanf("%d", &score);
        
        struct Node* node = head;
        int j = 0;
        
        while (node != NULL) {
            if (j >= start - 1 && j <= end - 1) {
                node->value += score;
            }
            
            node = node->next;
            j++;
        }
    }
    
    int min = head->value;
    struct Node* node = head->next;
    
    while (node != NULL) {
        if (node->value < min) {
            min = node->value;
        }
        
        node = node->next;
    }
    
    printf("%d", min);
    
    return 0;
}
